<template>
	<view class="song-list-comp">
		<view class="tit-bar">
			{{title}}
			<view @tap="goTo" class="more fr">歌单广场</view>
		</view>
		<view class="item-list">
			<view class="item" v-for="(item, index) in list" :key="index" @tap="toAlbum(item)">
				<image class="img" :src="item.picUrl"></image>
				<view class="desc ellipsis2">{{item.name}}</view>
				<view class="count"> {{ item.playCount}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		// 从父组件传值的 共有的有主标题，链接更多，歌单数据
		props: {
			title: {
				type: String,
				default: ''
			},
			link: {
				type: String,
				default: ''
			},
			list: {
				type: Array,
				default () { // 这里返回值需要是一个函数
					return []
				}
			}
		},
		data() {
			return {

			}
		},
		methods: {
			goTo() {
				this.$pubFuc.showToast("暂未开放")
			},
			toAlbum(obj) {	// 去歌单页
				uni.navigateTo({
					url: '/pages/subpages/index/album?item=' + encodeURIComponent(JSON.stringify(obj)),
				});
			},
			
		}
	}
</script>
<style lang="scss" scoped>
	.song-list-comp {

		.tit-bar {
			width: 650rpx;
			margin: 20rpx auto 0;
			font-size: 34rpx;
			font-weight: 600;
			line-height: 110rpx;

		}

		.more {
			border: 1px solid #e6e6e6;
			border-radius: 50rpx;
			margin-top: 30rpx;
			width: 150rpx;
			height: 50rpx;
			text-align: center;
			line-height: 50rpx;
			font-weight: 400;
			font-size: 24rpx;

		}

		.item-list {
			margin-left: 25rpx;
			display: flex;
			flex-wrap: wrap;

			.item {
				position: relative;
				width: 200rpx;
				margin-left: 25rpx;

				.img {
					border-radius: 10rpx;
					width: 100%;
					height: 200rpx;
				}

				.desc {
					height: 62rpx;
					width: 200rpx;
					margin-top: 12rpx;
					margin-bottom: 20rpx;
					line-height: 30rpx;
				}

				.count {
					position: absolute;
					top: 0;
					right: 0;
					color: #fff;
					padding-left: 25rpx;
					font-size: 24rpx;
					line-height: 34rpx;
					transform: scale(0.8);
					z-index: 10;
					background: url() no-repeat;
					background-size: 25rpx 25rpx;
				}
			}
		}
	}
</style>
